#pragma once


#include "maya/MPoint.h"
#include "Utilities.h"
#include "maya/MFnMesh.h"
#include <map>
#include <vector>
#include <set>
#include "EdgeBase.h"
#include "VertexBase.h"
#include "TriangleBase.h"
#include <algorithm>

using namespace std;

class SubMesh
{
public:
	SubMesh(double _radius, VertexBase* _vertex, map<int,TriangleBase*> _triangles, SubMesh* _prevSubMesh);
	~SubMesh(void);

	bool isValid();
	double getRadius();
	double getDistortionAtVertexAtRadiusFromSubmesh();
	
	void printFaces();
	void printDistortionProcess();

	vector<TriangleBase*> getTriangles();
	vector<VertexBase*> getVerticies();
  
private:
	void countEdges(vector<EdgeBase*> edges);
	bool addAdjacentTriangles(set<TriangleBase*>* inputOutput);

	bool valid;
	double radius; 
	VertexBase* vertex;
	map<int,TriangleBase*> allTriangles;	

	vector<TriangleBase*> triangles;	
	SubMesh* prevSubMesh;
	map<EdgeBase*,int> edgeCounter;
};

